home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13997 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.4 KB

  1. Path: dscomsa.desy.de!x4u2!mernst
  2. From: mernst@x4u2.desy.de (Matthias Ernst)
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Followup-To: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  6. Date: 28 Mar 1996 12:00:25 GMT
  7. Organization: DESY
  8. Message-ID: <4jdv0p$lnr@dscomsa.desy.de>
  9. References: <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu> <4j03p4$fbt@hoho.quake.net> <Doq3sv.MzA@research.att.com> <4jcf89$2k9@crc-news.doc.ca>
  10. NNTP-Posting-Host: x4u2.desy.de
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Slobodan Celenkovic (Celenkovic.Bob@ic.gc.ca) wrote:
  14. :    So the termination semantics is for cleaning-up just before process 
  15. : termination? Of course, that is quite valid viewpoint. However I am still 
  16. : not convinced that the resumption semantics is not valid.
  17.  
  18. :    Forgive my ignorance, for I did not read the book, but how is the 
  19. : following typical example handled: say reading a file with many read 
  20. : statements. Classical approach is check errno after each read statement. 
  21. : It seems to me that the resumption semantics is much better, since it 
  22. : covers all the code and concetrates error handling code into one place, 
  23. : at the end. Hence no need for repeated checking of errno. Another nice 
  24. : ting about resumption semantics is that it allows selective error 
  25. : handling at different levels using clear code. At each level the error 
  26. : handlers catch only the errors which it can handle, leaving others for 
  27. : the higher levels. Only at the top, application level the termination 
  28. : semantics is used because the error condition cannot be corrected.
  29.  
  30. :    Indeed it seems to me that both semantics are neeeded and complement 
  31. : each other very well. I have no big projects to cite as examples, but my 
  32. : personal limited expirience with smaller programs.
  33.  
  34. :    So why is the resumption semantics not needed? Of course it can always 
  35. : be replaced by explicit error checking, but exceptions seem much 
  36. : nicer/cleaner way of catching errors and many error conditions can be 
  37. : handled. Maybe it all boils down to the style preference, explicit error 
  38. : checking vs. resumption exceptions? In any case, why not give programmers 
  39. : the choice?
  40.  
  41. : Slobodan Celenkovic
  42.  
  43. : P.S.: I used exceptions in Delphi's Pascal language which uses resumption 
  44. : semantics until an exception reaches the top level where it causes 
  45. : termination. I use exceptions for "normal" errors, like errItemNotFound 
  46. : when searching in a table,...
  47.  
  48. I fear you are confusing something here. What you [seem to (sorry if I get
  49. you wrong)] understand by Resumption is: 'an exception not handled in an
  50. invocation frame is automatically passed to the next outer frame.'
  51.  
  52. This is not what is discussed in this thread.
  53.  
  54. The idea of resumption or retry is that after an inner frame throws an
  55. exception the outer handler may alter the state or supply more information
  56. and then _REENTER_ the inner frame either at the point where the exception
  57. was thrown (resumption) or at the beginning of the try block (retry).
  58.  
  59. The most used termination model means that after the exception is passed to
  60. the handler the inner invocation is no more existant, we can either
  61. explicitely try again (in a loop) or continue.
  62.  
  63. Again, if I misunderstood you, take this article as obsolete.
  64.  
  65. -- Matthias
  66.  
  67.  
  68.